# Compiler and linker settings
LIBS = OGRE CEGUI-OGRE CEGUI OGRENEWT NEWTON OIS openal freealut
LD = g++
LDFLAGS = -ggdb -O0 -Wall $(shell pkg-config --libs $(LIBS))
# LDFLAGS = -O0 -Wall $(shell pkg-config --libs $(LIBS))
SOURCES = $(wildcard src/*.cpp) ../podserver/SocketClient.cpp ../podserver/Socket.cpp
OBJECTS = $(SOURCES:.cpp=.o)

# Project object files
EXECUTABLE = IamOrb

.PHONY: all
all: sub_directories $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
	@echo Linking objects to $@
	@$(LD) $(LDFLAGS) $(OBJECTS) -o $@

.PHONY: sub_directories
sub_directories:
	@cd src; $(MAKE) -s
	@cd ../podserver; $(MAKE) -s

# Remove all object and dependency files and the executable
.PHONY: clean
clean:
	@echo Removing all of $(EXECUTABLE)\'s object, dependency and executable files
	@cd src; $(MAKE) -s clean
	@cd ../podserver; $(MAKE) -s clean
	@-rm -f $(EXECUTABLE)
